package com.example.administrator.taxicar.ui.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.CompoundButton;
import android.widget.Toast;

import com.example.administrator.taxicar.R;
import com.example.administrator.taxicar.utils.CheckSwitchButton;

public class ShezhiActivity extends Activity implements View.OnClickListener{

    private CheckSwitchButton mCheckSwithcButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); //声明使用自定义标题
        setContentView(R.layout.activity_shezhi_layout);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.shezhi_titlebar_layout);//自定义布局赋

        inint();
    }

    private void inint() {
        findViewById(R.id.title_left_img).setOnClickListener(this);

        mCheckSwithcButton = (CheckSwitchButton)findViewById(R.id.mCheckSwithcButton);
        mCheckSwithcButton.setChecked(true);
        mCheckSwithcButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if(isChecked){
                    Toast.makeText(getApplicationContext(),"关闭声音",Toast.LENGTH_SHORT).show();
                }else{
                    Toast.makeText(getApplicationContext(),"开启声音",Toast.LENGTH_SHORT).show();
                }
            }
        });
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.title_left_img:
                finish();
                break;
        }
    }
}
